package com.sharkburner.common.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;


/**
 * 
 * @author mtuvrila
 * 
 */
public class SimpleMD5Encryptor {

    /**
     * Return encrypting value of string
     * 
     * @param toEncrypt
     * @return
     * @throws CanifException
     */
    public static String encrypt(String toEncrypt) throws Exception {
        String ret = null;
        try {
            MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
            digest.update(toEncrypt.getBytes());
            ret = new String(digest.digest());
        } catch (NoSuchAlgorithmException e) {
            throw new Exception(e);
        }
        return ret;

    }
}